package com.sky.controller.user;

import com.sky.dto.UserLoginDTO;
import com.sky.result.Result;
import com.sky.service.UserService;
import com.sky.vo.UserLoginVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user/user")
@Slf4j
public class UserController {

    @Resource
    private UserService userService;


    @PostMapping("/login")
    @ApiOperation("用户微信登陆")
    public Result<UserLoginVO> login(@RequestBody UserLoginDTO dto){
        log.info("用户登陆，令牌{}",dto.getCode());
        UserLoginVO user = userService.wxLogin(dto);

        return Result.success(user );
    }
}
